package com.neutech.neureg.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neutech.neureg.service.InvoiceService;
import com.neutech.vo.ViewObject;

@RestController
@RequestMapping("/reg/invoice")
public class InvoiceController {
	@Autowired 
	private InvoiceService invoiceService;
	/**
	 * 点击挂号时，通时获取发票号
	 * @param invoice
	 * @return:当result=1时，status为200，添加发票信息成功；否则，添加失败
	 */
	@RequestMapping("/toAddInvoice")
	public ViewObject insertIntoInvoice(@RequestBody Map<String,Object> invoice){
		int result = invoiceService.insertIntoInvoice(invoice);
		if(result == 1){
			return new ViewObject("200","success");
		}else{
			return new ViewObject("403","failure");
		}
		
	}
}
